package com.retired_serviceman_management.service.impl;

import com.retired_serviceman_management.dao.AdminInfoDao;
import com.retired_serviceman_management.entity.AdminInfo;
import com.retired_serviceman_management.service.Admin_Info_Service;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class Admin_Info_Service_Impl implements Admin_Info_Service {

    @Resource
    private AdminInfoDao adminInfoDao;

    @Override
    public int CheckAccount(String admAccount, String admPassword) {
        AdminInfo adminInfo1 = adminInfoDao.queryByAccount(admAccount);
        if(adminInfo1 == null){//账号不存在
            return 1;
        }
        else {//账号存在，判断密码
            if(admPassword.equals(adminInfo1.getAdmPassword())){//密码正确
                return 0;
            }
            else return 2;//密码不正确
        }

    }
}
